package cz.proks.easyhelpdesk.gae.core.ws;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import cz.proks.easyhelpdesk.api.BaseHelpdeskApi;
import cz.proks.easyhelpdesk.api.exception.ApiException;
import cz.proks.easyhelpdesk.api.model.base.AnIdentifiableHelpdeskModel;
import cz.proks.easyhelpdesk.gae.core.manager.AHelpdeskManager;

public abstract class BaseHelpdeskApiImpl<Entity extends AnIdentifiableHelpdeskModel> extends BaseApiImpl<Entity> implements BaseHelpdeskApi<Entity> {        
    private final Logger log = LoggerFactory.getLogger(getClass());
    
    @Override
    protected abstract AHelpdeskManager<Entity> getManager();
    
    @Override
    public List<Entity> listForHelpdesk(Long helpdeskId) throws ApiException {
        log.debug("list():: Start with helpdeskId '{}'", helpdeskId);
        
        List<Entity> entities = getManager().listForHelpdesk(helpdeskId);
        
        log.debug("list():: End with {}", (entities == null ? "null list" : "list of " + entities.size() + " elements"));
        return entities;
    }
}
